[ToC] [Up] [Back] [Next] ... [Book Plug] The Information Commons
.................... Introduction to HTML

6.1 DIV -- Block Divisions

HTML 3 proposed the element DIV, which would allow you to block together other block body elements, and associate them together. This has practical purposes -- DIV can take the ALIGN attribute, and all blocks (P, BLOCKQUOTE, etc.) inside a DIV will inherit the text alignment specified by the outside DIV. Structurally, DIV can also take the CLASS attribute, which is used to specify the semantic meaning of the block. For example <DIV CLASS="abstract"> ..... </DIV> could be used to mark out the block of text that is a document's abstract. This is very useful when organizing text, and is much desired by document authors.

Netscape Navigator 2.0 supports the DIV element - thus it it likely to soon come into common usage.

6.1.1 Example of DIV

The following is an example of DIV (look below to see how it displays on your browser):
<DIV ALIGN="center" CLASS="test_block">
  <h3> Test Heading -- how is it aligned?</h3>
  <P>Here is the first paragraph. This will be center-aligned if
     the browser understands DIV.
  <P ALIGN="left">
     This second paragraph should be left-aligned,
     as the ALIGN attribute of the paragraph element should override
     the alignment specified by the outer element.
</DIV>
here is some following text. If the browser does not understand
DIV this line will flow into the previous paragraph -- therefore
make sure, if using DIV, to properly block out all text within
and outside the DIV.

...which is displayed as:


Test Heading -- how is it aligned?

Here is the first paragraph. This will be center-aligned if the browser understands DIV.

This second paragraph should be left-aligned, as the ALIGN attribute of the paragraph element should override the alignment specified by the outer element.

here is some following text. If the browser does not understand DIV this line will flow into the previous paragraph -- therefore make sure, if using DIV, to properly block out all text within and outside the DIV.


[ToC] [Up] [Back] [Next] ... [Book Plug] .................... Introduction to HTML

© Ian Graham 1994-1995 Page Last Updated: 4 December 1995